home *** CD-ROM | disk | FTP | other *** search
- Path: iz.maus.de!Torsten_Landschoff
- From: Torsten_Landschoff@iz.maus.de (Torsten Landschoff)
- Newsgroups: comp.lang.c++
- Subject: iostream error recovery
- Message-ID: <199603102354.a35684@iz.maus.de>
- Date: Sun, 10 Mar 96 21:54:00 GMT
- References: <313CADB5.39AF@babbage.cs.qc.edu>
- X-Gate: MausGate/News 1.25/ac3
- MIME-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
-
- -A40484@AC3
-
- Hi Christopher
-
- CV>Executing cin.clear() resets the ios::failbit and sets ios::goodbit,
- CV>and I would expect to be able to use cin again. However using both
- CV>g++ on Unix and Borland C++ I am unable to read anything from cin once
- CV>the user types in a letter. What does one do to recover?
-
- You have to remove the character from the input e.g. by doing a
-
- char no_digit;
-
- cin >> no_digit;
-
- After doing that you can start up your reading again.
-
- cu
- Torsten
-